#include <stdio.h>
#include <stdlib.h>

void scan(int* pa, int N)
{
	int i = 0;
	for(i = 0; i < N; i++)
		scanf("%d",&pa[i]);
}

void print(int* pa, int N)
{
	int i = 0;
	for(i = 0; i < N; i++)
		printf("%d ",pa[i]);
}
//方法1 库函数sqort
int cmp(const void* p1, const void* p2)
{
	return ( *(int*)p1 - *(int*)p2 );
}

//方法2 冒泡排序
void bubble(int* pa, int N)
{
	int i = 0;
	int j = 0;
	int flag = 1;
	for(i = 0; i < N; i++)//比较次数
	{
		for(j = 0; j < N-1; j++)
		{
			if(pa[j] < pa[j+1])
			{
				flag = 0;
				int temp = pa[j];
				pa[j] = pa[j+1];
				pa[j+1] = temp;

			}
		}
		if(flag == 1)
			break;
	}
}

int main()
{
	int n = 0;
	printf("输入一个正整数n(1<n≤10)\n");
	scanf("%d",&n);
	int arr[10] = {0};
	scan(arr, n);
	//qsort(arr, sizeof(arr)/sizeof(arr[0]), sizeof(arr[0]), cmp);//方法1
	bubble(arr,n);//方法2；
	print(arr, n);
	return 0;
}